package com.aula02.collectino;

import java.util.HashSet;
import java.util.Iterator;

//Set interface que herde de collection onde nao permite duplicidade
public class TestHashSet {
	public static void main(String[] args) {
		HashSet hs = new HashSet();
		hs.add("um");
		hs.add("dois");
		hs.add("tres");
		hs.add("quatro");
		hs.add("um");
		
		Iterator i = hs.iterator();
		String s;
		
		while(i.hasNext()){
			s = (String) i.next();
			System.out.println(s);
		}
		
		hs.clear();
		System.out.println(hs.size());
	}
}
